package com.example.demo

import com.example.demo.intercept.UserInfoIntercept
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.web.servlet.config.annotation.InterceptorRegistry
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer

@Configuration
class InterceptorConfig :WebMvcConfigurer{
    @Bean
    fun getUserInfoIntercept(): UserInfoIntercept {
        return UserInfoIntercept()
    }
    override fun addInterceptors(registry: InterceptorRegistry) {
        registry.addInterceptor(UserInfoIntercept()).addPathPatterns("/test/upload")
        super.addInterceptors(registry)
    }
}